package com.holystone.splunk.common;

import com.splunk.*;

import java.io.*;
import java.net.Socket;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;

/**
 * Copyright (c) 2017, HOLYSTONE Technologies, Inc.
 * All right reserved.
 *
 * @author huyan
 * @date 2017/11/2
 * @desc:
 */
public class SplunkDemo {

    public static void main(String[] arr) throws IOException {

//        ServiceArgs args = new ServiceArgs();
//        args.setUsername("admin");
//        args.setPassword("admin");
//        args.setHost("localhost");
//        args.setPort(8089);
//        args.setSSLSecurityProtocol(SSLSecurityProtocol.TLSv1_2);
//        args.setApp("event_manager");
//        args.setScheme("https");
//        Service service = Service.connect(args);
//
//        StringBuilder sb = new StringBuilder();
//        for (int i = 0; i < 10000; i++) {
//            System.out.println(i);
//            sb.append(i);
//        }
//        Index index = service.getIndexes().get("event_alert_index");
//        Args indexArgs = new Args();
//        indexArgs.put("sourcetype", "alert");
//        Socket socket = index.attach(indexArgs);
//        try {
//            OutputStream os = socket.getOutputStream();
//            os.write(sb.toString().getBytes());
//        } finally {
//            socket.close();
//        }
//        System.out.println("success!!");
    }

}
